public enum CommandType {
    CAR_LOGIN((byte) 0x01, "车辆登入"),

    REAL_TIME_INFORMATION((byte) 0x02, "实时上报"),

    REAL_TIME_INFORMATION_TOO((byte) 0x03, "实时补发上报"),

    CAR_LOGIN_OUT((byte) 0x04, "车辆登出");

    private final byte value;
    private final String description;

    CommandType(int value, String description) {
        this.value = (byte) value;
        this.description = description;
    }

    public byte getValue() {
        return value;
    }

    public String getDescription() {
        return description;
    }

    public static CommandType fromByte(byte value) {
        for (CommandType type : CommandType.values()) {
            if (type.value == value) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown CommandType value: " + value);
    }
}
